
    function controlDiv(DivID, divCase) {

        var divs = document.getElementById(DivID);

        var v_left = (document.body.clientWidth - 300) / 2 + document.body.scrollLeft; //divs.clientWidth

        var v_top = (document.body.clientHeight - divs.clientHeight) / 2 + document.body.scrollTop;

        if (divCase == 1) {

            divs.style.left = v_left + 'px';

            divs.style.top = v_top + 'px';

            divs.style.display = "block"; //显示DIV

        } else if (divCase == 2)

            divs.style.display = "none"; //屏蔽DIV

        else

            divs.innerHTML = divCase; //输出HTML文本到DIV

    }
   
   
    function myConfirm(message, callback) {
        $('#confirm').modal({
            close: false,
            position: ["20%", ],
            overlayId: 'confirmModalOverlay',
            containerId: 'confirmModalContainer',
            onShow: function (dialog) {
                dialog.data.find('.message').append(message);

                // if the user clicks "yes"
                dialog.data.find('.yes').click(function () {
                    // call the callback
                    if ($.isFunction(callback)) {
                        callback.apply();                      
                    }
                    // close the dialog
                    $.modal.close();
                });
            }
        }); 
    }   	


function kanceReport(imei,parentId)
{
	  $.ajax({
        type: "get",
        url: "projectReport",
        data: { "imei": imei,"baseId": parentId},
        dataType: "jsonp",
        success: function (datas) {
            if (datas.success == "sessionOut") {
                window.location = "index.html";
                return;
            }
           
           else if (datas.success == "true"){
				reportUrl = datas.reportId;
				$("#reportURLh").val(reportUrl);
				myConfirm("项目报告书已经生成完毕，是否下载导出?", function () {
               var url = $("#reportURLh").val();
                $("#comYes").attr("href", url); 
                location.reload();
            });
			}
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {     
			
        }
    });
}

function xiangmuReport(imei,parentId)
{
	  $.ajax({
        type: "get",
        url: "projectMain",
        data: { "imei": imei,"baseId": parentId},
        dataType: "jsonp",
        success: function (datas) {
            if (datas.success == "sessionOut") {
                window.location = "index.html";
                return;
            }
           
           else if (datas.success == "true"){
				reportUrl = datas.reportId;
				$("#reportURLh").val(reportUrl);
				myConfirm("勘察表已经生成完毕，是否下载导出?", function () {
				var url = $("#reportURLh").val();
                $("#comYes").attr("href", url); 
                location.reload();
            });
			}
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {     
			
        }
    });
}

function cesuanReport(imei,parentId)
{
	  $.ajax({
        type: "get",
        url: "projectYOC",
        data: { "imei": imei,"baseId": parentId},
        dataType: "jsonp",
        success: function (datas) {
            if (datas.success == "sessionOut") {
                window.location = "index.html";
                return;
            }
           
           else if (datas.success == "true"){
				reportUrl = datas.reportId;
				$("#reportURLh").val(reportUrl);
				myConfirm("项目测算表已经生成完毕，是否下载导出?", function () {
                var url = $("#reportURLh").val();
                $("#comYes").attr("href", url); 
                location.reload();
            });
			}
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {     
			
        }
    });
}